﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using PlanB.ShareDove.ConferenceOrganization.Portal.WebParts.MVP;

namespace PlanB.ShareDove.ConferenceOrganization.Portal.WebParts.DisplaySessions
{
    /// <summary>
    /// UserControl which is hosted in DisplaySessions webpart, and which actually implements the whole logic
    /// </summary>
    public partial class DisplaySessionsUserControl : UserControl, IDisplaySessionsView
    {
        /// <summary>
        /// Page load method of the DisplaySessionsUserControl user control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        /// <summary>
        /// Implement the SetData Method from interface, where we bind the ViewData to the controls inside UserControl
        /// </summary>
        /// <param name="data">Data from the veiw</param>
        public void SetData(DisplaySessionsModel data)
        {
            //
            //bind controls
            m_NumberOfSessionsLabel.Text = data.NumberOfSessions.ToString();

            m_SessionDataGridView.DataSource = data.SessionData;
            m_SessionDataGridView.DataBind();

        }
    }
}
